<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>lu_intangibleAssetsManagement   无形资产管理</title>
    <!--<link rel="shortcut icon" href="favicon.ico">-->
    <link href="ADMIN_PUBLIC/css/bootstrap.min.css" rel="stylesheet">
    <!--<link href="ADMIN_PUBLIC/css/font-awesome.min.css" rel="stylesheet">-->

    <link href="ADMIN_PUBLIC/css/animate.min.css" rel="stylesheet">
    <link href="ADMIN_PUBLIC/css/style.min.css" rel="stylesheet">

    <link rel="stylesheet" href="ADMIN_PUBLIC/css/lu_common.css">
    <link rel="stylesheet" href="ADMIN_PUBLIC/css/lu_projectProgress.css">
    <link rel="stylesheet" href="ADMIN_PUBLIC/css/lu_salaryManagement.css">
    <link rel="stylesheet" href="ADMIN_PUBLIC/fonts_style/iconfont.css">
    <style>
        .laydate-theme-molv .layui-laydate-main{
            height:300px!important;
        }
        .laydate-theme-molv .layui-laydate-content{
            height:300px!important;
            overflow: hidden!important;
        }
        .table_btn_list_title{
            text-align: right;
            width:200px;
        }
        .add_hiddenBox{
            padding: 0 20px 20px 0;
            max-height:500px;
        }
        input[readonly]{
            background-color: #EDEDED;
            color: #333;
        }
    </style>
</head>
<body class="color_fff row container-fluid">
<div class="row projectProgress_table_BOX">
    <div class="table_BOX">
        <table class="col-sm-12 table table-striped comTableStyle" id="table_table">
            <thead>
            <tr>
                <th><input type="checkbox" id="checkAll" class="checkboxStyle"></th>
                <th style="white-space: nowrap">名称</th>
                <th style="white-space: nowrap">类型</th>
                <th style="white-space: nowrap">开始时间</th>
                <th style="white-space: nowrap">结束时间</th>
                <th style="white-space: nowrap">摊销原值(元)</th>
                <th style="font-size:14px">月摊销额(元)</th>
                <th style="font-size:14px">已摊销月份</th>
                <th style="white-space: nowrap">操作</th>
            </tr>
            </thead>
            <tbody>
        <volist name = 'data' id = 'v'>
            <tr data-index="{$v.id}">
                <td><input type="checkbox" class="checkboxStyle"></td>
                <td data-name="edit_name">{$v.know_name}</td>
                <td data-name="edit_type">{$v.know_type}</td>
                <td data-name="edit_StartTime">{$v.start_time}</td>
                <td data-name="edit_EndTime">{$v.end_time}</td>
                <td data-name="edit_AmortizationPrice">{$v.know_price}</td>
                <td data-name="edit_MonAmortizationPrice_ed">{$v.know_month_money}</td>
                <td data-name="edit_AmortizationMon_ed">{$v.know_use_month}月</td>
                <td><a href="edit_people" class="edit_table">编辑</a></td>
            </tr>
        </volist>
            </tbody>
        </table>
        <div class="pagination"><ul><li>{$page}</li></ul></div>
        <div class="hidden_box">
            <div class="hidden_box_showBox ">
                <span id="dateVal">筛选</span>
                <i class="iconfont icon-jiantou"></i>
            </div>
            <ul class="hidden_box_hiddenBox">
                <li class=" hidden_box_hiddenBox_list ">
                    <span class="hiddenBox_list_text">名称：</span>
                    <input type="text" class=" BFBFBF_inputStyle" data-query="name">
                </li>
                <li class=" hidden_box_hiddenBox_list ">
                    <span class="hiddenBox_list_text">类型：</span>
                    <!-- <input type="text" class=" BFBFBF_inputStyle" data-query="type"> -->
                    <select class="BFBFBF_inputStyle " name=""  data-query="type">
                        <option></option>
                        <option value='1'>非专利技术</option>
                        <option value='2'>专利权</option>
                        <option value='3'>软件</option>
                    </select>
                </li>
                <li class=" hidden_box_hiddenBox_list ">
                    <span class="hiddenBox_list_text">时间：</span>
                    <input type="text" class=" BFBFBF_inputStyle" id="choose_queryDate">
                </li>
                <li class="hiddenBox_list_btn">
                    <button class="btn btn-sm btn-success" id="query">确定</button>
                    <button class="btn btn-sm btn-default">取消</button>
                </li>
            </ul>
        </div>
        <ul class="operation_btn">
            <li><a href="add_people" class="btn btn-success">添加</a></li>
            <li><a href="#import" class="btn btn-success">批量导入</a></li>
            <li><a href="#delete" class="btn btn-success">批量删除</a></li>
        </ul>
        <ul class="animated fadeIn add_hiddenBox" lll="add_people" id='add_people'>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>名称：</label>
                <div class="col-sm-8">
                    <input type="text" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="add_name">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>类型：</label>
                <div class="col-sm-8">
                    <!--<input type="text" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="add_type">-->
                    <select class="form-control table_btn_list_selectStyle" add_name="add_type">
                        <option value="非专利技术">非专利技术</option>
                        <option value="专利权">专利权</option>
                        <option value="软件">软件</option>
                    </select>
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>开始时间：</label>
                <div class="col-sm-8">
                    <input type="text" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="add_StartTime" id="add_StartTime">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>结束时间：</label>
                <div class="col-sm-8">
                    <input type="text" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="add_EndTime" id="add_EndTime">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>摊销月数：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" readonly add_name="add_EstimateAmortizationMon">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>摊销原值(元)：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="add_AmortizationPrice">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title">月摊销额(元)：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" readonly placeholder="" add_name="add_MonAmortizationPrice_ed">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>已摊销月份：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="add_AmortizationMon_ed">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title">已摊销额(元)：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" readonly placeholder="" add_name="add_AmortizationPrice_ed">
                </div>
            </li>
            <li class="button_list">
                <button class="btn btn-sm btn-success" id="add_btn">确认添加</button>
                <button class="btn btn-sm btn-success" id="add_AddNew_btn">添加并新增</button>
                <button class="btn btn-sm btn-default cancel_btn">取消</button>
            </li>
        </ul>
        <ul class="animated fadeIn add_hiddenBox" lll="edit_people" id='edit_people'>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>名称：</label>
                <div class="col-sm-8">
                    <input type="text" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="edit_name">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>类型：</label>
                <div class="col-sm-8">
                    <!--<input type="text" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="edit_type">-->
                    <select class="form-control table_btn_list_selectStyle" add_name="edit_type">
                        <option value="非专利技术">非专利技术</option>
                        <option value="专利权">专利权</option>
                        <option value="软件">软件</option>
                    </select>
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>开始时间：</label>
                <div class="col-sm-8">
                    <input type="text" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="edit_StartTime" id="edit_StartTime">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>结束时间：</label>
                <div class="col-sm-8">
                    <input type="text" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="edit_EndTime" id="edit_EndTime">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>摊销月数：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="edit_EstimateAmortizationMon">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>摊销原值(元)：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="edit_AmortizationPrice">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title">月摊销额(元)：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" readonly placeholder="" add_name="edit_MonAmortizationPrice_ed">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title"><i class="iconfont icon-asterisk table_btn_list_necessary"></i>已摊销月份：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" placeholder="" add_name="edit_AmortizationMon_ed">
                </div>
            </li>
            <li class="form-group table_btn_list">
                <label class="col-sm-4 control-label table_btn_list_title">已摊销额(元)：</label>
                <div class="col-sm-8">
                    <input type="number" class="col-sm-9 BFBFBF_inputStyle add_people_input" readonly placeholder="" add_name="edit_AmortizationPrice_ed">
                </div>
            </li>
            <li class="button_list">
                <button class="btn btn-sm btn-success" id="save_btn">保存</button>
                <button class="btn btn-sm btn-default cancel_btn">取消</button>
            </li>
        </ul>
    </div>

    <!--内容没填完，弹框-->
    <div class="warning_hiddenBox animated fadeIn" id="yz_modal" box="yz_modal">
        您有内容没有填写完哦！
    </div>
    <!--删除人员-->
    <div class="col-sm-12 add_people_list animated fadeIn" id="delete" lll="delete">
        <p class="delete_tip_text">确认删除吗？</p>
        <div class="delete_tip_btn_box">
            <button class="btn btn-sm btn-success">确认</button>
            <button class="btn btn-sm btn-default">取消</button>
        </div>
    </div>
    <!--导入文件-->
    <div class="add_hiddenBox animated fadeIn" id="import" lll="import">
        <p class="import_tip_text">温馨提示：</p>
        <p class="import_tip_text">请下载统一的模版，并按相应的格式在Excel软件中填写您的业务数据，然后再导入到系统中。</p>
        <form action="/Admin/Knowledge/importKnow" method="post" enctype="multipart/form-data" id="file_form">
            <input type="file" accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" class="import_tip_text file_upload_btn" id="file_upload" name="knows">
            <div class="import_tip_btn_box">
                <a class="btn btn-sm btn-success" href="/Excel/tpl/无形资产批量导入模板.xls">下载模板</a>
                <button class="btn btn-sm btn-grey">确定导入</button>
            </div>
        </form>
    </div>
</div>

<script src="ADMIN_PUBLIC/js/jquery.min.js"></script>
<script src="ADMIN_PUBLIC/js/laydate/laydate.js"></script>
<script src="ADMIN_PUBLIC/js/lu_intangibleAssetsManagement.js"></script>
<script>
    $(function(){
        window.choose_queryDate = ''
        window.query_time_start = '';
        window.query_time_end = '';
//        window.add_StartTime = ''
//        window.add_StartTime_year = ''
//        window.add_StartTime_month = ''
//        window.add_StartTime_date = ''
//        window.add_EndTime = ''
//        window.add_EndTime_year = ''
//        window.add_EndTime_month = ''
//        window.add_EndTime_date = ''

//        window.edit_StartTime = ''
//        window.edit_EndTime = ''

        laydate.render({
            elem: '#choose_queryDate', //指定元素
            type:  'month',
            theme: '#2881C1',
            range: true,
            done: function(value, date, endDate){
                let dateVal = date.year+'年'+date.month+'月至'+endDate.year+'年'+endDate.month+'月'
                window.choose_queryDate = dateVal
                window.query_time_start = date.year+'-'+date.month;
                window.query_time_end = endDate.year+'-'+endDate.month;
            }
        })
        laydate.render({
            elem: '#add_StartTime', //指定元素
            theme: '#2881C1',
            done: function(value, date, endDate){

                if($('#add_EndTime').val()){
                    // let add_EndTime = (new Date($('#add_EndTime').val())).getTime()
                    // let add_StartTime = (new Date(value)).getTime()
                    // if(add_EndTime<add_StartTime){
                    //     $('#yz_modal').html('开始时间不得小于结束时间!')
                    //     $('#yz_modal').addClass('active')
                    //     tipShow()
                    //     return
                    // }else{
                    //     let mon = Math.ceil((add_EndTime-add_StartTime)/1000/3600/24/31)
                    //     $('#add_people').find('[add_name=add_EstimateAmortizationMon]').val(mon)
                    // }

                    let add_EndTime_year = ($('#add_EndTime').val()).split('-')[0]
                    let add_EndTime_mon = ($('#add_EndTime').val()).split('-')[1]
                    let add_EndTime_day = ($('#add_EndTime').val()).split('-')[2]
                    let add_StartTime_year = date.year
                    let add_StartTime_mon = date.month
                    let add_StartTime_day = date.date

                    let mon

                    if(add_StartTime_year>add_EndTime_year){
                        $('#yz_modal').html('开始时间不得小于结束时间!')
                        $('#yz_modal').addClass('active')
                        tipShow()
                        return
                    }else if(add_StartTime_year==add_EndTime_year){
                        if(add_StartTime_mon>add_EndTime_mon){
                            $('#yz_modal').html('开始时间不得小于结束时间!')
                            $('#yz_modal').addClass('active')
                            tipShow()
                            return
                        }else{
                            mon = add_EndTime_mon - add_StartTime_mon
                        }
                    }else{
                        let year = add_EndTime_year - add_StartTime_year
                        if(year==1){
                            mon = 12-add_StartTime_mon+add_EndTime_mon
                        }else{
                            mon = (12-add_StartTime_mon+add_EndTime_mon)+12*(year-1)
                        }
                    }

                    $('#add_people').find('[add_name=add_EstimateAmortizationMon]').val(mon)

                }

            }
        });

        laydate.render({
            elem: '#add_EndTime', //指定元素
            theme: '#2881C1',
            done: function(value, date, endDate){
                if($('#add_StartTime').val()){
                    // let add_StartTime = (new Date($('#add_StartTime').val())).getTime()
                    // let add_EndTime = (new Date(value)).getTime()
                    // if(add_EndTime<add_StartTime){
                    //     $('#yz_modal').html('开始时间不得小于结束时间!')
                    //     $('#yz_modal').addClass('active')
                    //     tipShow()
                    //     return
                    // }else{
                    //     let mon = Math.ceil((add_EndTime-add_StartTime)/1000/3600/24/31)
                    //     $('#add_people').find('[add_name=add_EstimateAmortizationMon]').val(mon)
                    // }
                    let add_StartTime_year = ($('#add_StartTime').val()).split('-')[0]
                    let add_StartTime_mon = ($('#add_StartTime').val()).split('-')[1]
                    let add_StartTime_day = ($('#add_StartTime').val()).split('-')[2]
                    let add_EndTime_year = date.year
                    let add_EndTime_mon = date.month
                    let add_EndTime_day = date.date

                    let mon

                    if(add_StartTime_year>add_EndTime_year){
                        $('#yz_modal').html('开始时间不得小于结束时间!')
                        $('#yz_modal').addClass('active')
                        tipShow()
                        return
                    }else if(add_StartTime_year==add_EndTime_year){
                        if(add_StartTime_mon>add_EndTime_mon){
                            $('#yz_modal').html('开始时间不得小于结束时间!')
                            $('#yz_modal').addClass('active')
                            tipShow()
                            return
                        }else{
                            mon = add_EndTime_mon - add_StartTime_mon
                            console.log(mon)
                        }
                    }else{
                        let year = add_EndTime_year - add_StartTime_year
                        if(year==1){
                            mon = 12-add_StartTime_mon+add_EndTime_mon
                            console.log(mon)
                        }else{
                            mon = (12-add_StartTime_mon+add_EndTime_mon)+12*(year-1)
                            console.log(mon)
                        }
                    }

                    $('#add_people').find('[add_name=add_EstimateAmortizationMon]').val(mon)
                }
            }
        })
        laydate.render({
            elem: '#edit_StartTime', //指定元素
            theme: '#2881C1',
            done: function(value, date, endDate){
                
               if($('#edit_EndTime').val()){
                    let edit_EndTime_year = ($('#edit_EndTime').val()).split('-')[0]
                    let edit_EndTime_mon = ($('#edit_EndTime').val()).split('-')[1]
                    let edit_EndTime_day = ($('#edit_EndTime').val()).split('-')[2]
                    let edit_StartTime_year = date.year
                    let edit_StartTime_mon = date.month
                    let edit_StartTime_day = date.date

                    let mon

                    if(edit_StartTime_year>edit_EndTime_year){
                        $('#yz_modal').html('开始时间不得小于结束时间!')
                        $('#yz_modal').addClass('active')
                        tipShow()
                        return
                    }else if(edit_StartTime_year==edit_EndTime_year){
                        if(edit_StartTime_mon>edit_EndTime_mon){
                            $('#yz_modal').html('开始时间不得小于结束时间!')
                            $('#yz_modal').addClass('active')
                            tipShow()
                            return
                        }else{
                            mon = edit_EndTime_mon - edit_StartTime_mon
                        }
                    }else{
                        let year = edit_EndTime_year - edit_StartTime_year
                        if(year==1){
                            mon = 12-edit_StartTime_mon + Number(edit_EndTime_mon)
                        }else{
                            mon = (12-edit_StartTime_mon + Number(edit_EndTime_mon))+12*(year-1)
                        }
                    }

                    $('#edit_people').find('[add_name=edit_EstimateAmortizationMon]').val(mon)

                }

            }
        })
        laydate.render({
            elem: '#edit_EndTime', //指定元素
            theme: '#2881C1',
            done: function(value, date, endDate){

                if($('#edit_StartTime').val()){
                    let edit_StartTime_year = ($('#edit_StartTime').val()).split('-')[0]
                    let edit_StartTime_mon = ($('#edit_StartTime').val()).split('-')[1]
                    let edit_StartTime_day = ($('#edit_StartTime').val()).split('-')[2]
                    let edit_EndTime_year = date.year
                    let edit_EndTime_mon = date.month
                    let edit_EndTime_day = date.date

                    let mon

                    if(edit_StartTime_year>edit_EndTime_year){
                        $('#yz_modal').html('开始时间不得小于结束时间!')
                        $('#yz_modal').addClass('active')
                        tipShow()
                        return
                    }else if(edit_StartTime_year==edit_EndTime_year){
                        if(edit_StartTime_mon>edit_EndTime_mon){
                            $('#yz_modal').html('开始时间不得小于结束时间!')
                            $('#yz_modal').addClass('active')
                            tipShow()
                            return
                        }else{
                            mon = edit_EndTime_mon - edit_StartTime_mon
                        }
                    }else{
                        let year = edit_EndTime_year - edit_StartTime_year
                        if(year==1){
                            mon = 12-edit_StartTime_mon+edit_EndTime_mon
                        }else{
                            mon = (12-edit_StartTime_mon+edit_EndTime_mon)+12*(year-1)
                        }
                    }

                    $('#edit_people').find('[add_name=edit_EstimateAmortizationMon]').val(mon)
                }

            }
        })

        // 弹出来的小框框
        function tipShow(){
            window.tipBox = setTimeout(function(){
                // $('#yz_modal').removeClass('active')
                // $('#yz_modal').addClass('fadeOut')
                $('#yz_modal').removeClass('active')
                clearTimeout(tipBox)
            },2000)
        }
    })
</script>
</body>
</html>